<?

require_once ("application.list.inc");

global $_GLOBAL_DBH;
global $_OBJECT_IFACE_PANEL;
global $_IFACE_CONTROL_OBJECT;
global $_SET_TABBING;

$_SET_TABBING = true;

$fs_local_document = $_SERVER["PHP_SELF"];

$indexes = array (
	transaction=>array (label=>"Transaction",order=>"DEFAULT"),
	transaction_date=>array (label=>"Transaction Date",order=>"DEFAULT",
			callback=>"_template_list_substring",length=>16),
	unit_price=>array (label=>"Unit Price",order=>"DEFAULT"),
	units_ordered=>array (label=>"Units Ordered",order=>"DEFAULT"),
);

$link_options_path = array (
	array (
		fs_tab=>"inv_ctl_item_entry",
		fs_tab_option=>"lc_inv_ctl_item_entry",
		object_id=>"item_id",
		object_value=>$_REQUEST["item_id"],
	)
);

$link_options = _app_create_tabbing (null, $link_options_path);

$object_ctl_path = array (
        array (
                fs_action=>"view",
		fs_tab=>"inv_ctl_item_entry",
		fs_tab_option=>"fs_inv_ctl_item_entry",
		object_id=>"item_id",
		object_value=>$_REQUEST["item_id"],
        )
);

$object_ctl = _app_create_tabbing ( "{$fs_local_document}?",
                $object_ctl_path) . "&";

$list_options_path = array (
	array (
		fs_action=>"addnew",
		fs_tab=>"inv_ctl_item_entry",
		fs_tab_option=>"fs_inv_ctl_item_entry",
		object_id=>"item_id",
		object_value=>$_REQUEST["item_id"],
	)
);

$list_options = array (
	array (
		label=>"Add An Order Item",
		link=>_app_create_tabbing ("{$fs_local_document}?", $list_options_path)
	),
);


$_OBJECT_IFACE_LIST = _app_create_list_object (array (
		db_conn=>$_GLOBAL_DBH,
		indexes=>$indexes,
		list_count=>"SELECT COUNT(*) FROM inv_ctl_item_entry WHERE item_id={$_REQUEST["item_id"]}",
		list_select=>"SELECT * FROM inv_ctl_item_entry WHERE item_id={$_REQUEST["item_id"]}",
		list_id=>"lc_inv_ctl_item_entry",
		list_options=>$list_options,
		primary_key=>"id",
		primary_relation=>"item_entry_id",
		link_options=>$link_options,
		object_ctl=>$object_ctl
));

array_push ($_IFACE_CONTROL_OBJECT, $_OBJECT_IFACE_LIST);

?>
